<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //1.for 重复执行某段代码， 通常跟计数有关系
        //2. for 语法结构
        // for （初始化变量；条件表达式；操作表达式）{
         /*    循环体
        } */
        
        /* for (var a = 1; a <= 20; a++) {
            console.log(a);
        } */
        /* for (var a = 1; a <= 100; a++) {
            if (a % 2 == 0) {
                console.log(a);
            }
        } */
        /* for (var a = 1; a <= 100; a++) {
            if (a % 2 == 1) {
                console.log(a);
            }
        } */
        /* for (var a = 1; a <= 100; a++) {
            if (a % 3 == 0) {
                console.log(a);
            }
        } */

        //打印一到一百的和
        /* var b = 0
        for (var a = 1; a <= 100; a++) {
            b = b + a
        }
        console.log(b); */
        /* var b = 0
        for (var a = 1; a <= 100; a++) {
            b = b + a
        }
        console.log(b);  */

    </script>
</body>
</html>